/**============================================================================
 Confidential Information - Limited distribution to authorized persons only.
 This software is protected as an unpublished work under the U.S. Copyright
 Act of 1976.

 Copyright (c) 2011, BluePhoenix Solutions, Inc. All rights reserved.
 ----------------------------------------------------------------------------
 file......: NotepadCloudDialog.java
 Author....: Vyacheslav Kovalyov
 Created...: 28.10.11

 Description:

 ============================================================================*/
package ru.monyag.pred.swing.ui.notepad;

import ru.monyag.pred.core.tag.Tag;
import ru.monyag.pred.core.tag.TagsCloud;
import ru.monyag.pred.swing.ui.listeners.IUpdateListener;
import ru.monyag.pred.swing.ui.tagsCloud.TagsPanel;
import ru.monyag.pred.swing.ui.windows.BaseDialog;

import static ru.monyag.pred.core.utils.PredCoreUtils.getString;
import static ru.monyag.pred.swing.util.PredSwingConstants.DESKTOP_HEIGHT;
import static ru.monyag.pred.swing.util.PredSwingConstants.DESKTOP_WIDTH;

/**
 * @author Vyacheslav Kovalyov
 * @version 1.0
 */
public class NotepadCloudDialog extends BaseDialog implements IUpdateListener<Tag> {

    public NotepadCloudDialog(IUpdateListener<Tag> listener) {
        super(getString("tags.cloud"), DESKTOP_WIDTH, DESKTOP_HEIGHT);
        this.listener = listener;

        setModal(true);
        add(new TagsPanel(new TagsCloud(), this));
    }

    @Override
    public void dispatchUpdate(Tag object) {
        listener.dispatchUpdate(object);
        dispose();
    }

    private final IUpdateListener<Tag> listener;
}
